package com.wing.platform.cabinet;


import com.alibaba.druid.support.spring.stat.annotation.Stat;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.apache.commons.lang.StringUtils;

import java.io.Serializable;

/**
 * 刀具柜供货商入驻
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class Supplier extends BaseEntity<Supplier> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum SubjectType implements IEnum<Integer> {

        /**
         * 制造业企业
         */
        manufacturing(0,"制造业企业"),
        /**
         * 第三服务商
         */
        serviceProvider(1,"第三服务商"),
        /**
         * 应用开发者
         */
        developers(2,"应用开发者");

        private int code;
        private String desc;

        SubjectType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }

        @JsonCreator
        public static SubjectType jsonCreator(String name) {
            if (StringUtils.isNotBlank(name)) {
                for (SubjectType item : values()) {
                    if (item.name().equals(name.trim())) {
                        return item;
                    }
                }
            }
            return null;
        }
    }

    public enum SubjectNature implements IEnum<Integer> {

        /**
         * 央企/国企
         */
        centralEnterprise(0,"央企/国企"),
        /**
         * 股份公司
         */
        shares(1,"股份公司"),
        /**
         * 有限责任公司
         */
        limitedLiability(2,"有限责任公司"),
        /**
         * 个体户
         */
        individual(3,"个体户");

        private int code;
        private String desc;

        SubjectNature(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }

        @JsonCreator
        public static SubjectNature jsonCreator(String name) {
            if (StringUtils.isNotBlank(name)) {
                for (SubjectNature item : values()) {
                    if (item.name().equals(name.trim())) {
                        return item;
                    }
                }
            }
            return null;
        }
    }

    public enum IndustryId implements IEnum<Integer> {

        /**
         * 生产行业
         */
        productionIndustry(0,"生产行业"),
        /**
         * 制造行业
         */
        nmanufacturingIndustry(1,"制造行业"),
        /**
         * 互联网行业
         */
        iTIndustry(2,"互联网行业");

        private int code;
        private String desc;

        IndustryId(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }

        @JsonCreator
        public static IndustryId jsonCreator(String name) {
            if (StringUtils.isNotBlank(name)) {
                for (IndustryId item : values()) {
                    if (item.name().equals(name.trim())) {
                        return item;
                    }
                }
            }
            return null;
        }
    }

    public enum Status implements IEnum<Integer> {

        /**
         * 生效
         */
        takeEffect(0,"生效"),
        /**
         * 禁用
         */
        disabled(1,"禁用");

        private int code;
        private String desc;

        Status(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }

        @JsonCreator
        public static Status jsonCreator(String name) {
            if (StringUtils.isNotBlank(name)) {
                for (Status item : values()) {
                    if (item.name().equals(name.trim())) {
                        return item;
                    }
                }
            }
            return null;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 入驻企业ID
     */
    private String companyId;

    /**
     * 供应商名称
     */
    private String companyName;

    /**
     * 主体类型
     */
    private String subjectType;

    /**
     * 主体类型描述
     */
    @TableField(exist = false)
    private String subjectTypeDesc;

    public String getSubjectTypeDesc() {
        if (subjectType==null){
            return null;
        }else{
            SubjectType subjectType1=SubjectType.jsonCreator(this.subjectType);
            if (subjectType1==null){
                return null;
            }else{
                return subjectType1.getDesc();
            }

        }
    }

    /**
     * 主体性质
     */
    private Object subjectNature;

    /**
     * 主体性质描述
     */
    @TableField(exist = false)
    private String subjectNatureDesc;

    public String getSubjectNatureDesc() {
        if (subjectNature == null){
            return null;
        }else{
            SubjectNature subjectNature=SubjectNature.jsonCreator(this.subjectNature.toString());
            if (subjectNature==null){
                return null;
            }else{
                return subjectNature.getDesc();
            }
        }
    }

    /**
     * 所属行业
     */
    private Object industryId;

    /**
     * 所属行业描述
     */
    @TableField(exist = false)
    private String industryIdDesc;

    public String getIndustryIdDesc() {
        if (industryId == null){
            return null;
        }else{
            IndustryId industryId=IndustryId.jsonCreator(this.industryId.toString());
            if (industryId==null){
                return null;
            }else{
                return industryId.getDesc();
            }
        }
    }

    /**
     * 统一信用代码
     */
    private String creditCode;

    /**
     * 证件附件
     */
    private String credentials;

    /**
     * 企业照片
     */
    private String photo;

    /**
     * 银行账号
     */
    private String bankAccount;

    /**
     * 开户行
     */
    private String bank;

    /**
     * 开户许可证
     */
    private String license;

    /**
     * 省
     */
    private Long province;

    /**
     * 市
     */
    private Long city;

    /**
     * 区
     */
    private Long area;

    /**
     * 详情地址
     */
    private String address;

    /**
     * 管理员编码(UID)
     */
    private Integer administratorCode;

    /**
     * 管理员名称
     */
    private String administratorName;

    /**
     * 管理员id
     */
    private Long administratorId;

    /**
     * 简介
     */
    private String introduction;

    /**
     * 状态
     */
    private Object status;

    /**
     * 状态描述
     */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        if (status==null){
            return null;
        }else{
            Status status=Status.jsonCreator(this.status.toString());
            if (status==null){
                return null;
            }else{
                return status.getDesc();
            }
        }
    }

}
